package Algorithm.others;

import java.util.Random;

/**
 * desc     :
 * dateTime : 2020/7/29 8:58
 *
 * @author cww
 */

public class RandomVoid {
    public static void main(String[] args) {
        getRandomByRange1(120,500);
    }

    public static void getRandomByRange(int min,int max){
        // Math.random() 产生随机数 [0.0，1.0)
        System.out.println((int)(Math.random()*(max-min+1)+min));
    }

    public static void getRandomByRange1(int min,int max){
        Random r = new Random();
        int num = r.nextInt(max) % (max-min+1)+min;
        System.out.println(num);
    }
}
